#include "type.h"

int dimension(int type)
{
	switch(type)
	{
		case 0:
			return 2;				// cst_entier

		case 1:
			return 8;				// cst_reel

		case 2:
			return 2;				// cst_boolean

		case 3:
			return -1;				// cst_string	

		case 4:
			return -1;				// cst_char

		case 5:
			return -1;				// cst_byte

		case 6:
			return 4;				// var_entier

		case 7:
			return -1;				// var_reel

		case 8:
			return -1;				// var_boolean

		case 9:
			return -1;				// var_string

		case 10:
			return -1;				// var_char

		case 11:
			return -1;				// var_byte

		default:
			return -1;
	}
}
void affichageTypeIdentificateur(int type, char *buffer)
{
	switch(type)
	{
		case 0:
			sprintf(buffer, "cst_entier");
			break;

		case 1:
			sprintf(buffer, "cst_reel");
			break;

		case 2:
			sprintf(buffer, "cst_boolean");
			break;

		case 3:
			sprintf(buffer, "cst_string");
			break;

		case 4:
			sprintf(buffer, "cst_char");
			break;

		case 5:
			sprintf(buffer, "cst_byte");
			break;

		case 6:
			sprintf(buffer, "var_entier");
			break;

		case 7:
			sprintf(buffer, "var_reel");
			break;

		case 8:
			sprintf(buffer, "var_boolean");
			break;

		case 9:
			sprintf(buffer, "var_string");
			break;

		case 10:
			sprintf(buffer, "var_char");
			break;

		case 11:
			sprintf(buffer, "var_byte");
			break;

		default:
			sprintf(buffer, "inconnu");
			break;
	}
}

void affichageTypeLiteral(int type, char *buffer)
{
	switch(type)
	{
		case 0:
			sprintf(buffer, "Integer");
			break;

		case 1:
			sprintf(buffer, "Real");
			break;

		case 2:
			sprintf(buffer, "Boolean");
			break;

		case 3:
			sprintf(buffer, "String");
			break;

		case 4:
			sprintf(buffer, "Char");
			break;

		case 5:
			sprintf(buffer, "Byte");
			break;
	}
}
